//
//  Base64Helper.m
//  学习Trip-160201
//
//  Created by 马文星 on 16/2/2.
//  Copyright © 2016年 Se7ven. All rights reserved.
//

#import "Base64Helper.h"

@implementation Base64Helper

//编码
- (NSString *)base64Encode:(NSString *)string
{
    NSData *data = [string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:true];
    return [data base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
}
//解码
- (NSString *)base64Decode:(NSString *)string
{
    NSData *data = [[NSData alloc] initWithBase64EncodedString:string options:NSDataBase64DecodingIgnoreUnknownCharacters];
    return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
}

@end
